import {h} from 'vue';
import {useGlobSetting} from "@/hooks/setting";
import {api as viewerApi} from "v-viewer"

const globalSetting = useGlobSetting();

export const columns = [
  {
    title: '图片',
    key: 'filePath',
    width: 50,
    align: 'center',
    render(row) {
      return h('img', {
        src: `${globalSetting.urlPrefix}${row.filePath}`,
        class: 'my-img',
        onClick: () => {
          viewerApi({
            images: [`${globalSetting.urlPrefix}${row.filePath}`],
            options: {
              toolbar: true,
            },
          })
        }
      })
    }
  },
  {
    title: '来源',
    key: 'origin',
    width: 80,
    align: 'center',
  },
  {
    title: '大小',
    key: 'size',
    width: 40,
    align: 'center',
  },
  {
    title: '创建用户',
    key: 'createUser',
    width: 80,
    align: 'center',
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 120,
    align: 'center',
  },
];
